package com.da.sumup.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Value("${file.disk.path}")
    private String filePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //指定静态文件路径
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
        //指定文件下载路径
        registry.addResourceHandler("/downFile/**").addResourceLocations("file:"+filePath);
    }
}
